package com.gosling.cloudspace.common.constants;

import lombok.Getter;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

/**
 * 监控枚举
 * 暂时不放数据字典 由于变化可能比较频繁
 *
 * @author lihonglin
 * @date 2024/3/18 14:22
 */
public enum PrometheusTitleEnum {

    //==========================其它-发送至开发群==========================
    OTHER(200000, "其它", "系统异常"),
    NACOS(200000, "紧急", "服务监听"),
    //==========================登录注册==========================
    LOGIN_REGISTER(200001, "登录注册", "注册"),
    LOGIN_LOGIN(200001, "登录注册", "登录"),

    //==========================服务商资源==========================
    OCR_IDCARD_CHUANGLAN(200002, "服务商资源", "创蓝-ocr身份证识别接口调用"),
    OCR_IDCARD_TENCENT(200002, "服务商资源", "腾讯-ocr身份证识别接口调用"),
    OCR_BANKCARD_CHUANGLAN(200002, "服务商资源", "创蓝-ocr银行卡识别接口调用"),
    OCR_BANKCARD_TENCENT(200002, "服务商资源", "腾讯-ocr银行卡识别接口调用"),
    THREE_AUTH_CHUANGLAN(200002, "服务商资源", "创蓝-三要素接口调用"),
    THREE_AUTH_TENCENT(200002, "服务商资源", "腾讯-三要素接口调用"),
    FOUR_AUTH_CHUANGLAN(200002, "服务商资源", "创蓝-四要素接口调用"),
    FOUR_AUTH_TENCENT(200002, "服务商资源", "腾讯-四要素接口调用"),
    LIVING_BODY_CHUANGLAN(200002, "服务商资源", "创蓝-活体接口调用"),
    LIVING_BODY_TENCENT(200002, "服务商资源", "腾讯-活体接口调用"),


    //==========================支付通道==========================
    PING_AN_PAY_SIGN_BANK(200003, "支付通道", "平安付-签约发起接口调用"),
    PING_AN_PAY_SIGN_BANK_CONFIRM(200003, "支付通道", "平安付-签约验证接口调用"),
    PING_AN_PAY_LOAN(200003, "支付通道", "平安付-放款接口调用"),
    PING_AN_PAY_REPAY(200003, "支付通道", "平安付-还款接口调用"),
    PING_AN_PAY_ORDER_INFO_QUERY(200003, "支付通道", "平安付-支付订单查询接口调用"),
    PING_AN_PAY_LOAN_ERROR(200003, "支付通道", "平安付-放款失败通知"),
    PING_AN_PAY_LOAN_AMT_CALL_POLICE(200003, "支付通道", "平安付-放款余额预警"),
    PING_AN_PAY_LOAN_AMT_AMT_CHECK(200003, "支付通道", "对账异常"),

    //==========================经营分析==========================
    ANALYSIS_CREDIT(200004, "经营分析", "渠道授信转化"),
    ANALYSIS_FINANCIAL_REPAY(200004, "经营分析", "财务统计数据【还款】"),
    ANALYSIS_FINANCIAL_LOAN(200004, "经营分析", "财务统计数据【借款】"),

    //==========================授信业务==========================
    CREDIT_DUPLICATE_ID_CARD(200005,"授信业务","身份证重复预警"),
    CREDIT_CREATE(200005,"授信业务","授信记录创建"),
    CREDIT_SUBMIT(200005,"授信业务","授信提交"),

    //==========================用信业务==========================
    LOAN_BUSINESS_PWD(200006, "用信业务", "待验证-交易密码验证结果"),

    //==========================api全流程==========================
    API_FLOW_QUERY_AGREEMENT(200006,"api全流程", "查询产品协议"),
    API_FLOW_REGISTER(200006,"api全流程", "进件"),
    API_FLOW_H5PAGE(200006,"api全流程", "获取H5入口链接"),
    API_FLOW_CREDIT_QUERY(200006,"api全流程", "授信结果查询"),
    API_FLOW_CREDIT_NOTIFY(200006,"api全流程", "授信结果回调"),
    API_FLOW_CREDIT_CHECK(200006,"api全流程", "用信校验"),
    API_FLOW_ORDER_CHECK(200006,"api全流程", "订单数据查询"),
    API_FLOW_ORDER_NOTIFY(200006,"api全流程", "订单数据推送"),

    SIGNATURE_FDD(200007,"签章服务", "法大大"),
    SMS_DANMI(200008,"短信服务", "发送短信")


    ;

    public static HashSet<String> typeList = new HashSet<>();
    public static HashSet<String> nameList = new HashSet<>();
    public static Map<String, HashSet<String>> typeNameList = new HashMap<>();
    @Getter
    private String type;
    @Getter
    private Integer code;
    @Getter
    private String name;

    PrometheusTitleEnum(Integer code, String type, String name) {
        this.type = type;
        this.name = name;
        this.code = code;
    }

    public static void init() {
        PrometheusTitleEnum[] values = PrometheusTitleEnum.values();
        for (PrometheusTitleEnum titleEnum : values) {
            typeList.add(titleEnum.getType());
            nameList.add(titleEnum.getName());
        }
        typeNameList.put("nameList", nameList);
        typeNameList.put("typeList", typeList);
    }

}
